AGG_ITERATORS

Section: SOS C++ LIBRARY (3S)
Updated: 6/6/1991
Index Return to Main Contents
man2html: unable to open or read file /usr/lib/ms/ms.acc
 

NAME

agg_iterators - iterator macros for arbitrary associations/collections  

SYNOPSIS

#include "<SOS>/include/agg_use.h"

agg_iterate (Collection<Entity> c, Entity e)
{ ...
} agg_iterate_end (c, e)

agg_iterate_reverse (Collection<Entity> c, Entity e)
{ ...
} agg_iterate_reverse_end (c, e)

agg_iterate_double (Collection<Entity1> c1, Entity1 e1,
                    Collection<Entity2> c2, Entity2 e2, int comp)
{ ...
} agg_iterate_double_end (c1, e1, c2, e2, comp)

agg_iterate_association (Association<Key,Info> a, Key k, Info i)
{ ...
} agg_iterate_association_end (a, k, i)
 

DESCRIPTION

The above macros implement iterators for arbitrary associations/collections. The macros must surround the body over which the loop iterates.

The actual expression for an association/collection should be a variable, since it might be evaluated more than once. The actual expressions for the remaining parameters must be variables. These latter expressions may optionally be preceded by a type, in which case a variable of this type and the given name will be declared local to the loop body.

Within the loop body, the scanned association/collection must not be modified if cursor stability is not guaranteed. This is usually decided at creation time of an association/collection by setting a boolean create parameter named list_cursor appropriately. In any case, the current element must not be removed in the loop body.

The loop body may be left prematurely by break. If return (goto) is used for this purpose the storage allocated in the TEMP_CONTAINER for cursors local to the macro will not be freed.

agg_iterate[_end] (c, e)
Iterates over the collection c starting with the first element and sets e to the current element each time before entering the loop body.
agg_iterate_reverse[_end] (c, e)
Iterates over the collection c starting with the last element and sets e to the current element each time before entering the loop body.
agg_iterate_double[_end] (c1, e1, c2, e2, comp)
Iterates simultaneously over both collections c1, c2 starting with the first elements. e1, e2 are set to the current elements each time before entering the loop body. The variable comp, which should be of signed integral type, is set to -1, 1, 0, depending on whether only the first, second, or both collections are exhausted when the iteration terminates. comp is also set to 0 if the loop body is left by executing a break statement and neither collection is exhausted.
agg_iterate_association [_end] (a, key, info)
Iterates over the association a starting with the first element. key, info are set to the key, respectively info component of the current element each time before the loop body is entered.
 

FILES

<SOS>/src/agg/agg.sos
SOS schema file

<SOS>/src/agg/agg_sos.h
complete schema interface

<SOS>/src/agg/agg_use.h
restricted schema interface

<SOS>/src/agg/agg_ext.h
definition of iterators (automatically included by agg_use.h)

<SOS>/lib/sos.a
SOS library
 

SEE_ALSO

Association(3), Collection(3), sos_Aggregate(3), sos_Cursor(3)  

AUTHOR

Dietmar Theobald


 

Index

NAME
SYNOPSIS
DESCRIPTION
FILES
SEE_ALSO
AUTHOR

This document was created by man2html, using the manual pages.
Time: 00:37:57 GMT, March 30, 2022